import QtQuick
import QtQuick.Controls

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    ToolButton {
        anchors.centerIn: parent
        icon.source: "qrc:/icons/file.png"
        text: "打开菜单"
        onClicked: menu.open()

        Menu {
            id: menu
            MenuItem { text: "复制"; onTriggered: console.log("copy") }
            MenuItem { text: "粘贴"; onTriggered: console.log("paste") }
            MenuSeparator {}
            MenuItem { text: "新建"; onTriggered: console.log("create") }
        }
    }
}
